import request from '@/router/axios';

//生产线
//生产车间列表
export const getWorkshopList = (params) => {
  return request({
    url: '/api/hg-public/produceline/getShop',
    method: 'get',
    params: {
      ...params
    }
  })
}
//生产线分页
export const getLineList = (current, size, params) => {
  return request({
    url: '/api/hg-public/produceline/page',
    method: 'get',
    params: {
      ...params, current, size,
    }
  })
}
//生产线列表
export const getLines = (params) => {
  return request({
    url: '/api/hg-public/produceline/list',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增生产线
export const addLine = (row) => {
  return request({
    url: '/api/hg-public/produceline/save',
    method: 'post',
    data: row
  })
}

//删除生产线
export const removeLine = (ids) => {
  return request({
    url: '/api/hg-public/produceline/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新生产线
export const updateLine = (row) => {
  return request({
    url: '/api/hg-public/produceline/submit',
    method: 'post',
    data: row
  })
}

//获取生产线
export const getLine = (id) => {
  return request({
    url: '/api/hg-public/produceline/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


//工序
//工序分页
export const getProcessPage = (current, size, params) => {
  return request({
    url: '/api/hg-public/procedure/page',
    method: 'get',
    params: {
      current, size,
      ...params,
    }
  })
}
//工序列表
export const getProcessList = (params) => {
  return request({
    url: '/api/hg-public/procedure/list',
    method: 'get',
    params: {
      ...params,
    }
  })
}
//新增工序
export const addProcess = (row) => {
  return request({
    url: '/api/hg-public/procedure/save',
    method: 'post',
    data: row
  })
}

//删除工序
export const removeProcess = (ids) => {
  return request({
    url: '/api/hg-public/procedure/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新工序
export const updateProcess = (row) => {
  return request({
    url: '/api/hg-public/procedure/update',
    method: 'post',
    data: row
  })
}

//获取工序详情
export const getProcess = (id) => {
  return request({
    url: '/api/hg-public/procedure/detail',
    method: 'get',
    params: {
      id,
    }
  })
}
//根据工艺获取工序编号
export const getProcessNo = (craftType) => {
  return request({
    url: '/api/hg-public/procedure/getMaxProcedureNo',
    method: 'get',
    params: {
      craftType,
    }
  })
}

//产品类型
//产品类型列表
export const getProducttypeList = () => {
  return request({
    url: '/api/hg-public/prdtype/list',
    method: 'get',
  })
}
//新增产品类型
export const addProducttype = (row) => {
  return request({
    url: '/api/hg-public/prdtype/save',
    method: 'post',
    data: row
  })
}

//删除产品类型
export const removeProducttype = (ids) => {
  return request({
    url: '/api/hg-public/prdtype/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新产品类型
export const updateProducttype = (row) => {
  return request({
    url: '/api/hg-public/prdtype/update',
    method: 'post',
    data: row
  })
}

//获取产品类型详情
export const getProducttype = (id) => {
  return request({
    url: '/api/hg-public/prdtype/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


//材料类型
//材料类型列表
export const getMaterialtypeList = () => {
  return request({
    url: '/api/hg-public/materialtype/list',
    method: 'get',
  })
}
//新增材料类型
export const addMaterialtype = (row) => {
  return request({
    url: '/api/hg-public/materialtype/save',
    method: 'post',
    data: row
  })
}

//删除材料类型
export const removeMaterialtype = (ids) => {
  return request({
    url: '/api/hg-public/materialtype/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新材料类型
export const updateMaterialtype = (row) => {
  return request({
    url: '/api/hg-public/materialtype/update',
    method: 'post',
    data: row
  })
}

//获取材料类型详情
export const getMaterialtype = (id) => {
  return request({
    url: '/api/hg-public/materialtype/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


//物料组
//采购类型
export const getTree = (code) => {
  return request({
    url: '/api/hg-public/materialgroup/getTree',
    method: 'get',
    params: {
      code
    }
  })
}
//采购类型
export const getMaterialGroup = (code) => {
  return request({
    url: '/api/hg-public/materialgroup/getMaterialGroup',
    method: 'get',
    params: {
      materialType: code
    }
  })
}
//物料组列表
export const getMaterialgroupList = (params) => {
  return request({
    url: '/api/hg-public/materialgroup/list',
    method: 'get',
    params: {
      ...params
    }
  })
}
//物料组分页列表
export const getMaterialgroupPage = (current, size, params) => {
  return request({
    url: '/api/hg-public/materialgroup/page',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  })
}
//新增物料组
export const addMaterialgroup = (row) => {
  return request({
    url: '/api/hg-public/materialgroup/save',
    method: 'post',
    data: row
  })
}

//删除物料组
export const removeMaterialgroup = (ids) => {
  return request({
    url: '/api/hg-public/materialgroup/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新物料组
export const updateMaterialgroup = (row) => {
  return request({
    url: '/api/hg-public/materialgroup/update',
    method: 'post',
    data: row
  })
}

//获取物料组详情
export const getMaterialgroup = (id) => {
  return request({
    url: '/api/hg-public/materialgroup/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

